% Main program for phase screen generation by Zernike method
% Written by Benchu Lu; email:benchuul@163.com
% Taiyuan University of Technology
% 主要都是从 <<Numerical Simulation of Optical Wave Propagation,
% with examples in MATLAB>>, Written by Jason D,Schmidt
% 书中的第九章copy下来对应部分的代码
%clear; close all; clc;
function ph = MainFun_FFT_Based_method(params,r0)
params_tmp.PN = 1; % 相位屏的数量
params_tmp.D = params.D; % length of one side of square phase screen [m]
params_tmp.r0 = r0; % coherence diameter [m]
params_tmp.N = params.N; % number of grid points per side
params_tmp.L0 = params.L0; % outer scale [m] 
params_tmp.l0 = params.l0;% inner scale [m]
params_tmp.p_num = 3; % 次谐波补偿阶数

ph = ActionFun_FFT_Based_method(params_tmp); % 运行相位屏生成函数

% plotting
%x = (-params_tmp.N/2 : params_tmp.N/2-1) * params_tmp.D/params_tmp.N; 
%subplot(121);imagesc(ph(:,:,1)),colorbar;
%subplot(122);mesh(x,x,ph(:,:,1)),colorbar;
end
